<?php

namespace App\Listeners;

use App\Models\Log;
use Carbon\Carbon;
use Faker\Provider\DateTime;
use Illuminate\Auth\Events\Login;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\DB;

class UserLogin
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  LoginEvent  $event
     * @return void
     */
    public function handle(Login $event)
    {
        //
        $user = $event->user;
        Log::firstOrCreate(['user_id'=>$user->id,'user_name'=>$user->name,'time'=>Carbon::now(),'remember'=>$event->remember,'opration'=>'用户登录']);

    }

}
